package Object.objects;

import java.util.Objects;

public class objects1 {
    public static void main(String[] args) {
        Student stu1 = new Student(18,"wangwu");
        Student stu2 = new Student(18,"wangwu");
        Student stu3 = null;
        boolean e = stu1.equals(stu2);
        System.out.println(e);

        //判断是否相等
        boolean e2 = Objects.equals(stu1, stu2);
        System.out.println(e2);

        //判断对象是否为空
        boolean b = Objects.isNull(stu2);//对象是否为空,则返回true
        boolean b1 = Objects.isNull(stu3);
        System.out.println(b);
        System.out.println(b1);
        //与上面相反
        boolean c = Objects.nonNull(stu2);//对象是否为空,则返回false
        boolean c1 = Objects.nonNull(stu3);
        System.out.println(c);
        System.out.println(c1);
    }
}
